﻿using System;
using System.Collections.Generic;

namespace Permutations
{
    public static class Permutations
    {
        private static List<string> returnWords = new List<string>();     

        public static string[] GetPermutations(string word)
        {                     
            GetWord(word, "");
            return returnWords.ToArray();
        }

        public static void GetWord(string word, string prefix )
        {
            if (word.Length == 1)            
                returnWords.Add(prefix + word);            
            else            
                for (int i = 0; i < word.Length; i++)                
                    GetWord(word.Remove(i, 1), prefix + word[i]);                                     
        }
    }
}
